<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%--使用me.gacl.domain.CalculatiorBean --%>
<jsp:useBean id="calBean" class="web1.bean.CaluculatorBean" />
<%--接收用户输入的参数 --%>
<jsp:setProperty name="calBean" property="*" />
<%--上面一句相当于
calBean.setFirstNum(request.getParameter("firstNum"))<br>
calBean.setSecondNum(request.getParameter("secondNum")<br>
calBean.setOperator(request.getParameter("operator"))<br>
calBean.setResult(request.getParameter("result"))<br>
 --%>

<%
	calBean.calculate();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>使用jsp+javabean开发的简单计算器</title>
</head>
<body>
	<br> 计算结果是:
	<%--第一种写法 --%>
	<jsp:getProperty property="firstNum" name="calBean" />
	<jsp:getProperty property="operator" name="calBean" />
	<jsp:getProperty property="secondNum" name="calBean" />
	=
	<jsp:getProperty property="result" name="calBean" /> 
	<%--第二种写法 --%>
<%--	<%=calBean.getFirstNum() %>
	<%=calBean.getOperator() %>
	<%=calBean.getSecondNum() %>
	=
	<%=calBean.getResult() %>--%>
	<br>
	<hr>
	<br>
	<form action="javabean1.jsp" methid="post">
		<table border="1px">
			<tr>
				<td colspan="2">简单的计算器</td>
			</tr>
			<tr>
				<td>第一个参数</td>
				<td><input type="text" name="firstNum" /></td>
			</tr>
			<tr>
				<td>运算符</td>
				<td><select name="operator">
						<option value="+">+</option>
						<option value="-">-</option>
						<option value="*">*</option>
						<option value="/">/</option>
				</select></td>
			</tr>
			<tr>
				<td>第二个参数</td>
				<td><input type="text" name="secondNum" /></td>
			</tr>
			<tr>
				<td colspan="2"><input type="submit" value="计算" /></td>
			</tr>
		</table>
	</form>
</body>
</html>